<script>
  class Animal {
    name = ''
    age = 1

    static address = '地球'

    constructor(name, age) {
      this.name = name,
        this.age = age
    }
    eat(food) {
      console.log(`${this.name} 吃${food}`)
    }

    static sleep() {
      console.log(`所有动物在${this.address} 上休息`)
    }
  }
  // console.log(typeof Animal) 结果：函数

  const a1 = new Animal('银渐层', 1)
  // a1.name = '旺财'
  // a1.age = 3
  console.log(a1)
  a1.eat = '猫条'


  const a2 = new Animal('金毛', 3)
  console.log(a2)
  a2.eat = '牛排'

  // 静态属性的访问和赋值
  console.log('所有动物都在：', Animal.address)
  Animal.address = '火星'

  console.log('将来所有动物都在:', Animal.address)
</script>